UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+3O16l+t8+LkEGvs/CbsyOG4JYHQHe1mcmHa65vL1PE=' 
WHERE 
  key_id = '9a14ed75c3bd71767993a90e18750378f52de3fd1d0170efd9b287609049f131' 
  AND (
    token = '+3O16l+t8+LkEGvs/CbsyOG4JYHQHe1mcmHa65vL1PE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034