UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4i9vt+Fv1vdYfSYsihD2mfymx8wL3E/pxVewgUW1gfU=' 
WHERE 
  key_id = 'f74b7f2b2ce2aaab19b54eba73994177913a31a335512c6804c5b6fce3de96b8' 
  AND (
    token = '4i9vt+Fv1vdYfSYsihD2mfymx8wL3E/pxVewgUW1gfU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042