UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1Yoh0THmYFLx6h7nfVHNIgZiXK6qlkiwRuGpVnQz6ls=' 
WHERE 
  key_id = 'b295141effbec9e5bda583faa7c5783a52ea460d8f846b7039915bacc7b07db1' 
  AND (
    token = '1Yoh0THmYFLx6h7nfVHNIgZiXK6qlkiwRuGpVnQz6ls=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037