UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '56WZH97hd67cFybxfU31jhPOv85bXPowW7pueCXGWBc=' 
WHERE 
  key_id = '374f749be02bae87fef4c7c1a95aba038e4b91f0b19cb43a135e528991721c07' 
  AND (
    token = '56WZH97hd67cFybxfU31jhPOv85bXPowW7pueCXGWBc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040