UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ID5D2eLK4HIkpHfZ7IYkC/2VJiXp8rkp74eRP27oGBQ=' 
WHERE 
  key_id = '331357001a029231c0b8a5a5951998431ef802e2047e19bbf5f159390a10c78c' 
  AND (
    token = 'ID5D2eLK4HIkpHfZ7IYkC/2VJiXp8rkp74eRP27oGBQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038