UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'B0A4UMJpKo9hfH7awX3o5lNWuvHJ1EHGGcdaPNK+3IY=' 
WHERE 
  key_id = '284255ce8edef20ed5d482c7e3abe0756059594f04dceec4e6c75e6231b0480a' 
  AND (
    token = 'B0A4UMJpKo9hfH7awX3o5lNWuvHJ1EHGGcdaPNK+3IY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038