UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HlywxI6Vuh+O/Yog8lN29LZf+7uu7BmVLNFmH5fT1WQ=' 
WHERE 
  key_id = '3235b1030769632b855456ff6ca09078be2b21421cef0c83c645c09b10f49359' 
  AND (
    token = 'HlywxI6Vuh+O/Yog8lN29LZf+7uu7BmVLNFmH5fT1WQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045