UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'p3nhl8+Z2MNxXcOJkEg/0BR08Uaa+rkDIvHbt455/fM=' 
WHERE 
  key_id = 'f9c1c74275b66b0ae3565a429dd4b100ea1246b9bacdd46f374ce3d57ed84851' 
  AND (
    token = 'p3nhl8+Z2MNxXcOJkEg/0BR08Uaa+rkDIvHbt455/fM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040