UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0CdI+YDfspV8LloBplpbeU8r4pycJZ1EYCunMEqJNfU=' 
WHERE 
  key_id = '0195f484ac12e4c6496925a39dfe8c183b83a6c1a7747267ba2d4091d0856f8f' 
  AND (
    token = '0CdI+YDfspV8LloBplpbeU8r4pycJZ1EYCunMEqJNfU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00068