UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hvf87rCQhXMWK++YmdVyWWLmDwQtstJj6MKFPrkIj24=' 
WHERE 
  key_id = 'eb6b273a74c32a65afead460668347de096338491b6d3b63609889feb758381d' 
  AND (
    token = 'hvf87rCQhXMWK++YmdVyWWLmDwQtstJj6MKFPrkIj24=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032