UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EVSxcnQDDsVR+feHrffmdkHrCivtqGAvppPZJVWSr0U=' 
WHERE 
  key_id = '817435541e378a27ce38818dcbf6a6cc26b76c433a90f288a60e307b41743955' 
  AND (
    token = 'EVSxcnQDDsVR+feHrffmdkHrCivtqGAvppPZJVWSr0U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028