UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qVay4M12F3bu+cw+zYIOTl9wQYXS9yx/ZeLtBXRcubc=' 
WHERE 
  key_id = 'f1b400075056cc667d892f37558331b92ff6adf59470ae2313bcd99811f81ebf' 
  AND (
    token = 'qVay4M12F3bu+cw+zYIOTl9wQYXS9yx/ZeLtBXRcubc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036