UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lsmEPTNDYxyZ+M68Uo6nmq9kuOcxF/BgRqGbvlmMwcE=' 
WHERE 
  key_id = 'fa4b34079d58836ee4a04d77213ab402337860085fb8d5d8acd6f61be246edeb' 
  AND (
    token = 'lsmEPTNDYxyZ+M68Uo6nmq9kuOcxF/BgRqGbvlmMwcE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052