UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hYnDsXx/lbBHaRSpDQGdD//SfFcqzP582m6j44Fa7cI=' 
WHERE 
  key_id = '40365d381bc4a08401e8765b419dbbc938dbcaa0cd5b03c04d8350f55763a863' 
  AND (
    token = 'hYnDsXx/lbBHaRSpDQGdD//SfFcqzP582m6j44Fa7cI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023