UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nJsyDXCJGG31350kQsYGJ1ecqwI77fWS9yl4wurl0Qs=' 
WHERE 
  key_id = '5cd9cfeee2bb04bb2d7631b83a5b74d605b95436b63b2051e4d60aadabfb83bf' 
  AND (
    token = 'nJsyDXCJGG31350kQsYGJ1ecqwI77fWS9yl4wurl0Qs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031