UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gfdYK6FRkOE7tYX7ff+bIJMaMYU+1/a594rdjlQ+PJo=' 
WHERE 
  key_id = 'b1cad2809730cd7eabe9937cccbe312e5de0c40eb1a61a68009f49824bc30d13' 
  AND (
    token = 'gfdYK6FRkOE7tYX7ff+bIJMaMYU+1/a594rdjlQ+PJo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041