UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'S+i6a25lztSHWjsm1sBhPnq5hsF9b0hbgb7B9/8W2ho=' 
WHERE 
  key_id = '927a147d42d1c139ad4b561a5263fee02d678063f9a0d56f20748acdfe1b99fe' 
  AND (
    token = 'S+i6a25lztSHWjsm1sBhPnq5hsF9b0hbgb7B9/8W2ho=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040