UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XFUP4IkWhSiuFeP1nOi4RAv53AmQ6ouo74fhoirZCUY=' 
WHERE 
  key_id = '5d8bd1d1513dfc537d89b3b55dedfc165d2bac8b6c0d4f24464b70ece90b4294' 
  AND (
    token = 'XFUP4IkWhSiuFeP1nOi4RAv53AmQ6ouo74fhoirZCUY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047