UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XOc9qeMOfGi7WaBFCXa1y4JrJUIarkEbl8Tzi7W4D2s=' 
WHERE 
  key_id = '3c4520bc888753766c9635a53aeb0dacc3a52b6cfd82ae7593f96b07dbeab981' 
  AND (
    token = 'XOc9qeMOfGi7WaBFCXa1y4JrJUIarkEbl8Tzi7W4D2s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021