UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'F5cWr9hX1Mkg/yaUDfraO05dm/OUUmgVrGz7euqkKOg=' 
WHERE 
  key_id = 'f5e6cf107337402a0c25acb86c0efa9838f674b7011a7dba244b24e0cfacde3a' 
  AND (
    token = 'F5cWr9hX1Mkg/yaUDfraO05dm/OUUmgVrGz7euqkKOg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049