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

Query time 0.00035