UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fyn8aqlNi1wzFc+Lv1Oa9j4Mv2M18RUXOHr1Xi1piJw=' 
WHERE 
  key_id = 'f992ae75b26a1de8a6c18c8b50d59e1c2293430206d49d8edfed42484a9082e8' 
  AND (
    token = 'fyn8aqlNi1wzFc+Lv1Oa9j4Mv2M18RUXOHr1Xi1piJw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042