UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P+HXLnVGKng47bL4C6qNl46fpLhLuN6dBS0GXC7RNag=' 
WHERE 
  key_id = '21506337b7b8e7605cf94920273b4babf9ff914ed6beca8753e848ea0a0c5e26' 
  AND (
    token = 'P+HXLnVGKng47bL4C6qNl46fpLhLuN6dBS0GXC7RNag=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033