UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NAthHAFnSfkeme4nZtipF7QJq3GT3Yz/73mRC/zaK2s=' 
WHERE 
  key_id = 'd52e76fa7bb734007bfe22502c05956d161f92d0d3619b2f5ba46c5e2de2d242' 
  AND (
    token = 'NAthHAFnSfkeme4nZtipF7QJq3GT3Yz/73mRC/zaK2s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032