UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TSM/yh7y6U3iQrD3wDCEaTpfg68LAWzAUAPWa2tEbu0=' 
WHERE 
  key_id = '280ce6e3989f88395d370da082b9d99989424be3700e5271003d0131b4f3d77b' 
  AND (
    token = 'TSM/yh7y6U3iQrD3wDCEaTpfg68LAWzAUAPWa2tEbu0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024