UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Vr+3+HyhFsr7l0kaZgW1FaMTPrkq9TeOE9Qi6dsL1fI=' 
WHERE 
  key_id = '367fc467a8c22ea2999d7104a7a2ffb80e91f8356866a845a409ede3d9c2636e' 
  AND (
    token = 'Vr+3+HyhFsr7l0kaZgW1FaMTPrkq9TeOE9Qi6dsL1fI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027