UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gyqDp1v6uiwxe3+iHVaz1IjmFnvQ+wam67ctrSSvlsw=' 
WHERE 
  key_id = '6d07a8897173fea4254a75b38250f4627fd500d001ef76e8ac144b1ce44669fa' 
  AND (
    token = 'gyqDp1v6uiwxe3+iHVaz1IjmFnvQ+wam67ctrSSvlsw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017