UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rsXPj2VHPnNdmgGsL6RROXDYvX4M37Pk0jJroODKUns=' 
WHERE 
  key_id = '436fa25e09310a08cc8e04445f3daf77e65e3f7daa4474a50734fe43aee20f5c' 
  AND (
    token = 'rsXPj2VHPnNdmgGsL6RROXDYvX4M37Pk0jJroODKUns=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046