UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5WXeqvtp9IauEGo0QwO9C/fxrHg/ZKGkn4Q2uFqwqoo=' 
WHERE 
  key_id = '709917178e8781639968b3db4603f5412ede34f3b808161fea99a5088ff07621' 
  AND (
    token = '5WXeqvtp9IauEGo0QwO9C/fxrHg/ZKGkn4Q2uFqwqoo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039