UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8Ddlq9JsigQqZJQkcs78967drCWKpjdnwEyM//W7jkA=' 
WHERE 
  key_id = '8721ef5a1d6104d2a92f7ed9765985ae404fec017997701e2e1f044b0ee7addd' 
  AND (
    token = '8Ddlq9JsigQqZJQkcs78967drCWKpjdnwEyM//W7jkA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00068