UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cj9ltE9rN1QO1yBSpTqwPt7mReO4gNiYUWLZUhP2OuM=' 
WHERE 
  key_id = '45bb4bad46c5201b7ea23ccbb711fe74740e2047718e7156033678a3b0ee6db4' 
  AND (
    token = 'cj9ltE9rN1QO1yBSpTqwPt7mReO4gNiYUWLZUhP2OuM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029