UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yk+kc+ntcAlNuEgytTyuuou2kLjU4mGQJbDSiksyemc=' 
WHERE 
  key_id = 'cd3010f9a4f35671fea8e66ad16c0bf5fabc030514d61ff134c302c7bc18b031' 
  AND (
    token = 'yk+kc+ntcAlNuEgytTyuuou2kLjU4mGQJbDSiksyemc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040