UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XS5Ps6Z4CenQ9+UkrEl0XU04lByT96LE/GwoSw3fOVA=' 
WHERE 
  key_id = '3fce58c981518786db79e4a93031412a9e8ba2491d8a80e104cfe06279f63865' 
  AND (
    token = 'XS5Ps6Z4CenQ9+UkrEl0XU04lByT96LE/GwoSw3fOVA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035