UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'T1J3671f6wbmwO1ZqWtptJ6krEYyn4TFxMGhkoL3wio=' 
WHERE 
  key_id = 'a721a0537be185f42eb53df9ccbddb55977636e2a67446cb8bf9f478add7da50' 
  AND (
    token = 'T1J3671f6wbmwO1ZqWtptJ6krEYyn4TFxMGhkoL3wio=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035