UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EJrEFDmZNDX980YnANcECCxX7SiO6/sUjsoLSgdVBXU=' 
WHERE 
  key_id = '34c8ba6f4b6ea3959997d7fa338c8f4587596454f13a2c05c2cbf4fc598d8e2f' 
  AND (
    token = 'EJrEFDmZNDX980YnANcECCxX7SiO6/sUjsoLSgdVBXU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035