UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'b+Sbt6bKXW/CQV2AGIhjapdx5RhTWdgyIZtVR7/Pfq8=' 
WHERE 
  key_id = '02ab54d9ea4b7345d57398c3320083d28e53cdd03a7f935884a6a54d50e7c28d' 
  AND (
    token = 'b+Sbt6bKXW/CQV2AGIhjapdx5RhTWdgyIZtVR7/Pfq8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049