UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Gu0zcfp/wSNKeSWn/DDAqL8YyY/NFhOUHgjYQYjHevo=' 
WHERE 
  key_id = 'f8bd3abadb01ce23160f273ebffb77ca9bedf7c5069dc409525e6fcc4a406097' 
  AND (
    token = 'Gu0zcfp/wSNKeSWn/DDAqL8YyY/NFhOUHgjYQYjHevo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017