UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lRZhR1mG11LNTiw/uKjO/HEAd6ht2zQhiBFMyBLKddw=' 
WHERE 
  key_id = 'c65db4036438e7bf4fd179ec46d49d3d519791d859b40d1722aaadafceedf961' 
  AND (
    token = 'lRZhR1mG11LNTiw/uKjO/HEAd6ht2zQhiBFMyBLKddw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043