UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gRcZuc1LoqhF+vwTimE3FbTwiQ/WM1Qa4BXKSO1uw8s=' 
WHERE 
  key_id = '95e270353d8ad450bf252cb64d26cb36a44099595f0efbf192e497cc18f72ac8' 
  AND (
    token = 'gRcZuc1LoqhF+vwTimE3FbTwiQ/WM1Qa4BXKSO1uw8s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033