UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YZYMV5uoxI1SNK9HDbc+atV0rz5kahPY6KaWQ2b0hng=' 
WHERE 
  key_id = 'cb550595fd65a3d08fbb37dacb350e8d93e174698530d174b9c99b1dbb51cec4' 
  AND (
    token = 'YZYMV5uoxI1SNK9HDbc+atV0rz5kahPY6KaWQ2b0hng=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046