UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'K4V+vk7xLt6l++xAApr8z6ZJsk3vGm2z5zRTy5UHlB8=' 
WHERE 
  key_id = 'eb4311ddebfcb949c6f045b04c275085cecd2b0227664daad21e50a9fcb34559' 
  AND (
    token = 'K4V+vk7xLt6l++xAApr8z6ZJsk3vGm2z5zRTy5UHlB8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032