UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'm7WUpbrQqfzx+4xnlJiYvucfN3j+iFLmJiIr13WtW2I=' 
WHERE 
  key_id = '3d7db7421b59758862b428fa2bae6b4e48d364018d4dd6257de8efbadf1d704c' 
  AND (
    token = 'm7WUpbrQqfzx+4xnlJiYvucfN3j+iFLmJiIr13WtW2I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048