UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '54T5jYLPikUwnq2yqDi5Uj6NFEGJ34JsUFl78ZcvOhM=' 
WHERE 
  key_id = 'b9a48c9dbabe424ce71362f0d87b13d7b77da7137494f2bc2b9bfd45ad3bda85' 
  AND (
    token = '54T5jYLPikUwnq2yqDi5Uj6NFEGJ34JsUFl78ZcvOhM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024